package com.leetcode;

/**
 * @BelongsProject: LeetCode
 * @BelongsPackage: com.leetcode
 * @Author: lei
 * @CreateTime: 2024-04-01  09:05
 * @Description: TODO
 * @Version: 1.0
 */
public class 故障键盘 {
    public static void main(String[] args) {
        String s = "poiinter";
        System.out.println(finalString(s));
    }

    public static String finalString(String s) {
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            String str = String.valueOf(s.charAt(i));
            if (!str.equals("i")) {
                builder.append(str);
            } else {
                builder.reverse();
            }
        }
        return builder.toString();

    }
}
